STRCMP(expr1,expr2)|returns 0 if the strings are the same, -1 if the first argument is smaller than the second according to the current sort order, and 1 otherwise.
Math
ABS(X)|Returns the absolute value of X.
ACOS(X)|Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1.
ASIN(X)|Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1.
ATAN(X)|Returns the arc tangent of X, that is, the value whose tangent is X.
ATAN2(X,Y)|Returns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result.
CEILING(X)|Returns the smallest integer value not less than X.
COS(X)|Returns the cosine of X, where X is given in radians.
COT(X)|Returns the cotangent of X.
DEGREES(X)|Returns the argument X, converted from radians to degrees.
EXP(X)|Returns the value of e (the base of natural logarithms) raised to the power of X.
FLOOR(X)|Returns the largest integer value not greater than X.
LOG(X)|Returns the natural logarithm of X.
LOG10(X)|Returns the base-10 logarithm of X.
MOD(N,M)|Modulo (like the % operator in C). Returns the remainder of N divided by M.
PI()|Returns the value of PI.
POW(X,Y)|Returns the value of X raised to the power of Y.
POWER(X,Y)|Returns the value of X raised to the power of Y.
RADIANS(X)|Returns the argument X, converted from degrees to radians.
RAND(N)|Returns a random floating-point value in the range 0 to 1.0. If an integer argument N is specified, it is used as the seed value.
ROUND(X,D)|Returns the argument X, rounded to a number with D decimals. If D is 0, the result will have no decimal point.
SIGN(X)|Returns the sign of the argument as -1, 0 or 1, depending on whether X is negative, zero, or positive.
SIN(X)|Returns the sine of X, where X is given in radians.
SQRT(X)|Returns the non-negative square root of X.
TAN(X)|Returns the tangent of X, where X is given in radians.
TRUNCATE(X,D)|Returns the number X, truncated to D decimals. If D is 0, the result will have no decimal point or fractional part.
String
ASCII(str)|Returns the ASCII code value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL.
BIN(N)|Returns a string representation of the binary value of N, where N is a longlong (BIGINT) number.
CHAR(N,...)|interprets the arguments as integers and returns a string consisting of the characters given by the ASCII code values of those integers.
CHARACTER_LENGTH(str)|Returns the length of the string str.
CHAR_LENGTH(str)|Returns the length of the string str.
COALESCE(list)|Returns first non-NULL element in list.
CONCAT(str1,str2,...)|Returns the string that results from concatenating the arguments.
CONCAT_WS(separator, str1, str2,...)|stands for CONCAT With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments
CONV(N,from_base,to_base)|Converts numbers between different number bases. Returns a string representation of the number N, converted from base from_base to base to_base.
ELT(N,str1,str2,str3,...)|Returns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is less than 1 or greater than the number of arguments. ELT() is the complement of FIELD().
EXPORT_SET(bits,on,off,[separator,[number_of_bits]])|Returns a string where for every bit set in "bit", you get a "on" string and for every reset bit you get an "off" string. Each string is separated with "separator" (default ",") and only "number_of_bits" (default 64) of "bits" is used.
FIELD(str,str1,str2,str3,...)|Returns the index of str in the str1, str2, str3, ... list. Returns 0 if str is not found. FIELD() is the complement of ELT().
FIND_IN_SET(str,strlist)|Returns a value 1 to N if the string str is in the list strlist consisting of N substrings. A string list is a string composed of substrings separated by "," characters.
FORMAT(X,D)|Formats the number X to a format like "#,###,###.##", rounded to D decimals. If D is 0, the result will have no decimal point or fractional part.
HEX(N)|Returns a string representation of the hexadecimal value of N, where N is a longlong (BIGINT) number.
INSERT(str,pos,len,newstr)|Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr.
INSTR(str,substr)|Returns the position of the first occurrence of substring substr in string str
LCASE(str)|Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1).
LEFT(str,len)|Returns the leftmost len characters from the string str.
LENGTH(str)|Returns the length of the string str.
LOCATE(substr,str,pos)|Returns the position of the first occurrence of substring substr in string str, starting at position pos.
LOWER(str)|Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1).
LPAD(str,len,padstr)|Returns the string str, left-padded with the string padstr until str is len characters long.
LTRIM(str)|Returns the string str with leading space characters removed.
MAKE_SET(bits,str1,str2,...)|Returns a set (a string containing substrings separated by "," characters) consisting of the strings that have the corresponding bit in bits set. str1 corresponds to bit 0, str2 to bit 1, etc. NULL strings in str1, str2, ... are not appended to the result.
MID(str,pos,len)|Returns a substring len characters long from string str, starting at position pos.
OCT(N)|Returns a string representation of the octal value of N, where N is a longlong number.
OCTET_LENGTH(str)|Returns the length of the string str.
ORD(str)|If the leftmost character of the string str is a multi-byte character, returns the code of multi-byte character by returning the ASCII code value of the character
POSITION(substr IN str)|Returns the position of the first occurrence of substring substr in string str.
REPEAT(str,count)|Returns a string consisting of the string str repeated count times. If count <= 0, returns an empty string.
REPLACE(str,from_str,to_str)|Returns the string str with all all occurrences of the string from_str replaced by the string to_str.
REVERSE(str)|Returns the string str with the order of the characters reversed.
RIGHT(str,len)|Returns the rightmost len characters from the string str.
RPAD(str,len,padstr)|Returns the string str, right-padded with the string padstr until str is len characters long.
RTRIM(str)|Returns the string str with trailing space characters removed.
SOUNDEX(str)|Returns a soundex string from str. Two strings that sound "about the same" should have identical soundex strings.
SPACE(N)|Returns a string consisting of N space characters.
SUBSTRING(str,pos,len)|Returns a substring len characters long from string str, starting at position pos.
SUBSTRING_INDEX(str,delim,count)|Returns the substring from string str before count occurrences of the delimiter delim.
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)|Returns the string str with all remstr prefixes and/or suffixes removed. If none of the specifiers BOTH, LEADING or TRAILING are given, BOTH is assumed.
UCASE(str)|Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1).
UPPER(str)|Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1).
Date and Time
ADDDATE(date,INTERVAL expr type)|Performs date arithmetic.
CURDATE()|Returns today's date as a value in "YYYY-MM-DD" or YYYYMMDD format, depending on whether the function is used in a string or numeric context.
CURTIME()|Returns the current time as a value in "HH:MM:SS" or HHMMSS format, depending on whether the function is used in a string or numeric context.
DATE_ADD(date,INTERVAL expr type)|Performs date arithmetic.
DATE_FORMAT(date,format)|Formats the date value according to the format string.
DATE_SUB(date,INTERVAL expr type)|Performs date arithmetic.
DAYNAME(date)|Returns the name of the weekday for date.
DAYOFMONTH(date)|Returns the day of the month for date, in the range 1 to 31.
DAYOFWEEK(date)|Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard.
DAYOFYEAR(date)|Returns the day of the year for date, in the range 1 to 366.
EXTRACT
FROM_DAYS(N)|Given a daynumber N, returns a DATE value.
FROM_UNIXTIME(unix_timestamp,format)|Returns a representation of the unix_timestamp argument as a value in "YYYY-MM-DD HH:MM:SS" or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.
HOUR(time)|Returns the hour for time, in the range 0 to 23.
MINUTE(time)|Returns the minute for time, in the range 0 to 59.
MONTH(date)|Returns the month for date, in the range 1 to 12.
MONTHNAME(date)|Returns the name of the month for date.
NOW()|Returns the current date and time as a value in "YYYY-MM-DD HH:MM:SS" or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.
PERIOD_ADD(P,N)|Adds N months to period P (in the format YYMM or YYYYMM). Returns a value in the format YYYYMM.
PERIOD_DIFF(P1,P2)|Returns the number of months between periods P1 and P2. P1 and P2 should be in the format YYMM or YYYYMM.
QUARTER(date)|Returns the quarter of the year for date, in the range 1 to 4.
SECOND(time)|Returns the minute for time, in the range 0 to 59.
SEC_TO_TIME(seconds)|Returns the seconds argument, converted to hours, minutes and seconds, as a value in "HH:MM:SS" or HHMMSS format, depending on whether the function is used in a string or numeric context.
SUBDATE(date,INTERVAL expr type)|Performs date arithmetic.
SYSDATE()|Returns the current date and time as a value in "YYYY-MM-DD HH:MM:SS" or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.
TIME_FORMAT(time,format)|This is used like the DATE_FORMAT() function above, but the format string may contain only those format specifiers that handle hours, minutes and seconds.
TIME_TO_SEC(time)|Returns the time argument, converted to seconds.
TO_DAYS(date)|Given a date date, returns a daynumber (the number of days since year 0).
UNIX_TIMESTAMP(date)|If called with no argument, returns a Unix timestamp (seconds since "1970-01-01 00:00:00" GMT). If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since "1970-01-01 00:00:00" GMT.
WEEK(date)|With a single argument, returns the week for date, in the range 0 to 53
WEEKDAY(date)|Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 = Sunday).
YEAR(date)|Returns the year for date, in the range 1000 to 9999.
YEARWEEK(date,first)|Returns year and week for a date. The second arguments works exactly like the second argument to WEEK().
Summarizing
AVG(expr)|Returns the average value of expr.
BIT_AND(expr)|Returns the bitwise AND of all bits in expr. The calculation is performed with 64-bit (BIGINT precision).
BIT_OR(expr)|Returns the bitwise OR of all bits in expr. The calculation is performed with 64-bit (BIGINT precision).
COUNT(expr)|Returns a count of the number of non-NULL values in the rows retrieved by a SELECT statement.
MAX(expr)|Returns the maximum value of expr. May take a string argument; in such cases it returns the maximum string value.
MIN(expr)|Returns the minimum value of expr. May take a string argument; in such cases it returns the minimum string value.
STD(expr)|Returns the standard deviation of expr. This is an extension to ANSI SQL. The STDDEV() form of this function is provided for Oracle compatability.
STDDEV(expr)|Returns the standard deviation of expr. This is an extension to ANSI SQL. The STDDEV() form of this function is provided for Oracle compatability.
SUM(expr)|Returns the sum of expr. Note that if the return set has no rows, it returns NULL!
Miscellaneous
BENCHMARK(count,expr)|Executes the expression expr repeatedly count times. It may be used to time how fast MySQL processes the expression.
BIT_COUNT(N)|Returns the number of bits that are set in the argument N.
CONNECTION_ID()|Returns the connection id (thread_id) for the connection. Every connection has its own unique id.
DATABASE()|Returns the current database name.
DECODE(crypt_str,pass_str)|Descrypts the encrypted string crypt_str using pass_str as the password. crypt_str should be a string returned from ENCODE().
ENCODE(str,pass_str)|Encrypt str using pass_str as the password. To decrypt the result, use DECODE(). The results is a binary string of the same length as string. If you want to save it in a column, use a BLOB column type.
ENCRYPT(str[,salt])|Encrypt str using the Unix crypt() system call. The salt argument should be a string with two characters. (As of MySQL 3.22.16, salt may be longer than two characters.)
GET_LOCK(str,timeout)|Tries to obtain a lock with a name given by the string str, with a timeout of timeout seconds. Returns 1 if the lock was obtained successfully, 0 if the attempt timed out, or NULL if an error occurred (such as running out of memory or the thread was killed with mysqladmin kill).
INET_NTOA(expr)|Returns the network address (4 or 8 byte) for the numeric expression.
INET_ATON(expr)|Returns an integer that represents the numeric value for a network address Addresses may be 4 or 8 byte addresses.
LAST_INSERT_ID([expr])|Returns the last automatically generated value that was inserted into an AUTO_INCREMENT column.
LOAD_FILE(file_name)|Reads the file and returns the file contents as a string. The file must be on the server, you must specify the full pathname to the file, and you must have the file privilege.
MD5(string)|Calculates a MD5 checksum for the string. Value is returned as a 32 long hex number that may, for example, be used as a hash key.
PASSWORD(str)|Calculates a password string from the plaintext password str. This is the function that is used for encrypting MySQL passwords for storage in the Password column of the user grant table.
RELEASE_LOCK(str)|Releases the lock named by the string str that was obtained with GET_LOCK(). Returns 1 if the lock was released, 0 if the lock wasn't locked by this thread (in which case the lock is not released) and NULL if the named lock didn't exist.
SESSION_USER()|Returns the current MySQL user name.
SYSTEM_USER()|Returns the current MySQL user name.
USER()|Returns the current MySQL user name.
VERSION()|Returns a string indicating the MySQL server version.